import { createApp } from 'vue'
// import './style.css'
import './style/globalstyle.css'
import './style/animation.css'

import App from './App.vue'
import Particles from "vue3-particles"

// 路由
import router from './router/index.js'
// ElementPlus UI
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
// axios
import axios from 'axios'
// echarts
import ECharts from 'vue-echarts'
import "echarts"
// Store 状态管理
import store from './store/index.js'
// icon
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

const app = createApp(App)
    .use(router)
    .use(ElementPlus)
    .use(store)
    .use(Particles)

// 统一注册icon图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}

axios.defaults.baseURL="http://localhost:8080"

//设置一个拦截器，在请求头添加token信息
// axios.interceptors.request.use(
//     config=>{
//         if(localStorage.getItem('token')){
//             config.headers.Authorization=localStorage.getItem('token');
//         }
//         return config;
//     },
//     error=>{
//         return Promise.reject(error);
//     }
// )

app.config.globalProperties.$http=axios  // 请求设置为全局属性
app.config.globalProperties.$router=router
app.mount('#app')